//
//  TSCVCReg2SelectRole.m
//  Tsc_IOS
//
//  Created by Rio on 15-5-24.
//  Copyright (c) 2015年 idream. All rights reserved.
//

#import "TSCVCReg2SelectRole.h"
#import "TSCConstants.h"
#import "TSCMyUIUtil.h"
#import "TSCVCReg2SelectCity.h"

@interface TSCVCReg2SelectRole ()

@property (weak, nonatomic) IBOutlet UIButton *btnImCustomer;
@property (weak, nonatomic) IBOutlet UIButton *btnImGuide;

@end

@implementation TSCVCReg2SelectRole

+ (void) initialize {
    // 注：最多只调用一次
    
}

+ (id) vcReg2SelectRoleWithStoryboard {
    UIStoryboard * sb = [UIStoryboard storyboardWithName:UI_STORYBOARD_NAME_MAIN bundle:[NSBundle mainBundle]];
    return [sb instantiateViewControllerWithIdentifier:UI_VC_NAME_REG2_SELECT_ROLE];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 设置自定义导航栏
    _nbc = [[TSCMyNaviBarCreator alloc]initAndCreateWithViewController:self hasGoBackButton:YES goBackVC:nil hasAppLogo:YES titleResourceKey:@"title_select_role" iconResourceNameArray:nil iconClickedListenerArray:nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

- (IBAction)gotoSelectCity:(id)sender {
    TSCVCReg2SelectCity * vcReg2SelectCity = [TSCVCReg2SelectCity vcReg2SelectCityWithStoryboard];
    [[self navigationController] pushViewController:vcReg2SelectCity animated:YES];
    
    // VC间传递参数
    NSInteger userRole ;
    if (sender == _btnImCustomer) {
        userRole = DB_USER_ROLE_CUSTOMER;
    } else if(sender == _btnImGuide) {
        userRole = DB_USER_ROLE_GUIDE;
    } else {
        NSAssert(1 == 0, @"[E]%s: 无法通过按钮辨别用户身份！请检查按钮引用。", __FUNCTION__);
    }
    NSDictionary * inputDic = [NSDictionary dictionaryWithObject:[NSNumber numberWithLong:userRole ] forKey:AEKI_USER_ROLE];
    [[NSNotificationCenter defaultCenter]addObserver:vcReg2SelectCity selector:@selector(SELECTOR_GET_VC_INPUT) name:UI_VC_NAME_REG2_SELECT_CITY object:nil];
    [[NSNotificationCenter defaultCenter] postNotificationName:UI_VC_NAME_REG2_SELECT_CITY object:inputDic];
}



@end
